<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>鼠标事件</title>
    <style type="text/css">
        #box{
            width: 200px;
            height: 200px;
            background: url("img/girl.gif") no-repeat;
            position: absolute;
        }
        body{
            background: #000;
            height: 2000px;
        }
    </style>
</head>
<body>

<script type="text/javascript">
       window.onload=function(){
             //当鼠标在页面上滑动时触发该事件
             document.onmousemove=function(e){
                var  box=document.getElementById("box");
                //pageX  pageY 鼠标点在页面坐标系中的点
                 box.style.left= e.pageX-100+"px";
                 box.style.top= e.pageY-100+"px";
             }
       }
</script>
     <div id="box"></div>
</body>
</html>